package com.example.demo3;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class dmMainActivity extends AppCompatActivity {

    private EditText edit1,edit2;
    private TextView textView,textView2;
    private Button but1;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dm_main);
        edit1 = (EditText)findViewById(R.id.edi1);
        edit2 = (EditText)findViewById(R.id.edi2);
        but1 = (Button)findViewById(R.id.but1);
        final String password = "123456";

        but1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String spassword = edit2.getText().toString();
                if(spassword.equals(password)){
                    Intent intent = new Intent(dmMainActivity.this,demo33MainActivity.class);
                    Bundle bundle = new Bundle();
                    bundle.putString("id",edit1.getText().toString());
                    intent.putExtras(bundle);
                    startActivityForResult(intent,1);
                }
                else{
                    Toast.makeText(dmMainActivity.this, "密码错误", Toast.LENGTH_SHORT).show();
                    //Toast.makeText(dmMainActivity.this, spassword, Toast.LENGTH_SHORT).show();
                }

            }
        });

    }
}
